﻿
Namespace Validation
    <AttributeUsage(AttributeTargets.Property, AllowMultiple:=False, Inherited:=False)> Public Class DomainValidatorAttribute
        Inherits BaseValidatorAttribute

#Region " Declarations "

        Private _enumRequiredEntry As RequiredEntry = RequiredEntry.No
        Private _strData As String()

#End Region

#Region " Properties "

        Public ReadOnly Property Data() As String()
            Get
                Return _strData
            End Get
        End Property

        Public ReadOnly Property RequiredEntry() As RequiredEntry
            Get
                Return _enumRequiredEntry
            End Get
        End Property

#End Region

#Region " Constructors "

        Public Sub New(ByVal enumRequiredEntry As RequiredEntry, ByVal ParamArray strData() As String)
            _enumRequiredEntry = enumRequiredEntry
            ReDim _strData(strData.Length - 1)
            strData.CopyTo(_strData, 0)
        End Sub

#End Region

#Region " Methods "

        Public Overrides Function Create(ByVal strPropertyName As String) As Validator
            Return New Validator(AddressOf Validation.DomainValidationRules.DomainRule, New DomainRuleEventArgs(Me, strPropertyName), RuleType.Attribute)
        End Function

#End Region

    End Class

End Namespace
